
import {IAxisChartConfig,IAxiosChartOptions,DataSourceMgr,ChartConfigMgr,ChartIdMap,effect} from "@/index"
export default function(
    chartTarget?:ChartConfigMgr<IAxisChartConfig>,
    dataSource?:DataSourceMgr,
    reRender?:()=>void,
    destroyMySelf?:()=>void
    ){
    const container = document.getElementById(chartTarget?.getConfig("container"));
    const myChartTarget = (<any>window).echarts.init(container);
    const myOptions = <IAxiosChartOptions>chartTarget?.getConfig("ChartOptions") || {};
    myChartTarget.setOption(myOptions);

    myChartTarget.on('click', 'series', function () {
        const events = chartTarget?.getConfig("events");
        const newChart = ChartIdMap.get(events["button1"].target);
        newChart?.self.render();
    });
    effect(()=>{
        // innerSpan.innerHTML = chartTarget?.getConfig("title")||"空空如也";
    },[chartTarget]);

    effect(()=>{
        // console.log("dataSource，指定重绘区域工作，"+chartTarget?.getConfig("id"))
        // console.log(dataSource?.getFilter())
        // innerSpan.innerHTML = chartTarget?.getConfig("title")||"空空如也";
    },[dataSource]);
}